import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class CustomTheme extends InheritedWidget {
  CustomTheme({required this.themeData, required Widget child})
      : super(child: child);

  final TEThemeData themeData;

  static TEThemeData? of(BuildContext context) {
    final CustomTheme? inheritedTheme =
        context.dependOnInheritedWidgetOfExactType<CustomTheme>();
    assert(inheritedTheme != null);
    return inheritedTheme?.themeData;
  }

  @override
  bool updateShouldNotify(InheritedWidget oldWidget) {
    return true;
  }
}

/// 起名字的时候别把色值写在名字里面（灰色由于种类太多特殊处理）
class TEColorData with Diagnosticable {
  final Color primary = const Color(0xFF564BFF);
  final Color right = const Color(0xFF16C767); //正确颜色
  final Color wrong = const Color(0xFFFF6051); // 错误颜色
  final Color danger = const Color(0xFFE74719); // 危险操作颜色
  final Color mask = Colors.black.withOpacity(0.55);

  final TextColorData text = TextColorData();
  final BackgroundColorData background = BackgroundColorData();
  final BorderColorData border = BorderColorData();
  final IconColorData icon = IconColorData();
  final ShadowColorData shadow = ShadowColorData();
  final ChartColorData chart = ChartColorData();
}

class TEThemeData with Diagnosticable {
  TEThemeData() {
    colors = TEColorData();
  }

  late TEColorData colors;
}

/// 文本颜色(颜色不够用时，扩展颜色必须找设计师确认！！！)
class TextColorData with Diagnosticable {
  final Color dark = Color(0xFF333333);
  final Color light = Color(0xFFFFFFFF);
  final Color highLight = Color(0xFF605FFF);

  final Color gray80 = Color(0xFF333333);
  final Color gray60 = Color(0xFF666666);
  final Color gray50 = Color(0xFF808080);
  final Color white1 = Color(0xFFD8D8D8); //菜单文字
  final Color gray20 = Color(0xFFCCCCCC); //浅浅灰色文字，辅助性的文字，例如：输入框的提示信息
}

/// 背景颜色(颜色不够用时，扩展颜色必须找设计师确认！！！)
class BackgroundColorData with Diagnosticable {
  final Color primary = Color(0xFFF4F5F7); //主背景颜色
  final Color primary1 = Color(0xFF605FFF);
  final Color primary20 = Color(0xFF564BFF).withOpacity(0.2);
  final Color primaryDisabled = Color(0x80605FFF);
  final Color primary2 = Color(0xFFFF46CB);
  final Color primary5 = Color(0xFF8B5FFE).withOpacity(0.05);
  final Color light = Color(0xFFFFFFFF); //白色背景颜色
  final Color right15 = Color(0xFF16C767).withOpacity(0.15); // 浅绿色背景色
  final Color wrong15 = Color(0xFFFF6051).withOpacity(0.15); // 浅红色背景色
  final Color wrong = Color(0xFFFF6051); // 浅红色背景色
  final Color normal = Color(0xFFF6F6FB);

  final Color gray20 = Color(0xFFCCCCCC);
  final Color gray10 = Color(0xFFE6E6E6);
  final Color gray5 = Color(0xFFF2F2F2);
  final Color gray2 = Color(0xFF2C2C2C); //大屏幕通用背景色

  final Color purple_40467B = Color(0xFF40467B);
  final Color purple_6069B2 = Color(0xFF6069B2);
  final Color purple_4849FF = Color(0xFF4849FF);
  final Color blue_2F30DB = Color(0xFF2F30DB);
}

/// 边框颜色(颜色不够用时，扩展颜色必须找设计师确认！！！)
class BorderColorData with Diagnosticable {
  final Color primary = Color(0xFF8B5FFE);
  final Color gray10 = Color(0xFFE6E6E6);
  final Color gray1 = Color(0xFF979797);

  ///加班时添加， 需要以后确认 @
  final Color gray30 = Colors.black.withOpacity(0.3);

  final Color gray5 = Color(0xFFF2F2F2);
  final Color light10 = Color(0xFFFFFFFF).withOpacity(0.1);
}

/// 图标颜色(颜色不够用时，扩展颜色必须找设计师确认！！！)
class IconColorData with Diagnosticable {
  final Color gray60 = Color(0xFF666666);
  final Color gray50 = Color(0xFF808080);
  final Color light = Color(0xFFFFFFFF);
}

/// 阴影颜色(颜色不够用时，扩展颜色必须找设计师确认！！！)
class ShadowColorData with Diagnosticable {
  final Color box = Colors.black.withOpacity(0.06); // 边框阴影
}

/// 图表颜色(颜色不够用时，扩展颜色必须找设计师确认！！！)
class ChartColorData with Diagnosticable {
  final Color orange = Color(0xFFFAAD14); // 橘子橙
  final Color blue = Color(0xFF6C9EFE); // 蓝色
  final Color green = Color(0xFF72C689); // 绿色
  final Color cyan = Color(0xFF21C1C1); // 青色
  final Color indigo = Color(0xFF828AEB); // 靛色

  final Color orange15 = Color(0xFFFAAD14).withOpacity(0.15); // 橘子橙(浅)
  final Color blue15 = Color(0xFF6C9EFE).withOpacity(0.15); // 蓝色(浅)
  final Color green15 = Color(0xFF72C689).withOpacity(0.15); // 绿色(浅)
  final Color cyan15 = Color(0xFF21C1C1).withOpacity(0.15); // 青色(浅)
  final Color indigo15 = Color(0xFF828AEB).withOpacity(0.15); // 靛色(浅)
}
